function PagerView(id,grid,pageSize) {
	this.id = id;
	this.grid = grid;
	this.pageSize = pageSize;
	this.currentPage = 1;
	this.totalCount = 0;
	this.pageCount = 0;
	this.flag = false;
	this.flagFirst = false;
	this.flagPrev = false;
	this.flagNext = false;
	this.flagLast = false;
	this.divPageFlag = true;
	
	this.createDivPage = function() {
		var s = '<div class="pDiv">';
		s +='<div class="pDiv2 align_left" style="padding-top:2px; padding-bottom:2px;">';
		s +='<button class="divpage_btn" disabled id="startLabel' + this.id + '"><i class="fa fa-fast-backward" style="cursor:default;"></i></button>';
		s +='<button class="divpage_btn" disabled id="previousLabel' + this.id + '"><i class="fa fa-backward" style="cursor:default;"></i></button>';
		s +='<button class="divpage_btn" disabled id="nextLabel' + this.id + '"><i class="fa fa-forward" style="cursor:default;"></i></button>';
		s +='<button class="divpage_btn" disabled id="endLabel' + this.id + '"><i class="fa fa-fast-forward" style="cursor:default;"></i></button>';
		s +='<span class="divpage_label">每页显示</span>';
		s +='<input class="divpage_txtbox1" type="text" maxlength="10" value="0" id="pageSize' + this.id + '">';
		s +='<span class="divpage_label">条/共<label id="totalCount' + this.id + '">0</label>条记录&nbsp;&nbsp;</span>';
		s +='<span class="divpage_label">共<label id="totalPage' + this.id + '">0</label>页&nbsp;&nbsp;第</span>';
		s +='<input class="divpage_txtbox2" type="text" value="0" id="pageNo' + this.id + '"><span class="divpage_label">页</span></div></div>';
		
		/*
<div class="ui-jqgrid-pager" id="pager_list_2" style="width: 1123px;" dir="ltr">
	<div class="ui-pager-control" id="pg_pager_list_2" role="group">
		<table class="ui-pg-table ui-common-table ui-pager-table">
			<tbody>
				<tr>
					<td align="center" id="pager_list_2_center" style="width: 359px; white-space: pre;"><table class="ui-pg-table ui-common-table ui-paging-pager">
							<tbody>
								<tr>
									<td title="First Page" class="ui-pg-button ui-disabled" id="first_pager_list_2"><span class="glyphicon glyphicon-step-backward"></span></td>
									<td title="Previous Page" class="ui-pg-button ui-disabled" id="prev_pager_list_2"><span class="glyphicon glyphicon-backward"></span></td>
									<td class="ui-pg-button ui-disabled"><span class="ui-separator"></span></td>
									<td id="input_pager_list_2" dir="ltr"><input class="ui-pg-input form-control" role="textbox" type="text" size="2" maxlength="7" value="0"> 共 <span id="sp_1_pager_list_2">2</span> 页</td>
									<td class="ui-pg-button ui-disabled"><span class="ui-separator"></span></td>
									<td title="Next Page" class="ui-pg-button" id="next_pager_list_2"><span class="glyphicon glyphicon-forward"></span></td>
									<td title="Last Page" class="ui-pg-button" id="last_pager_list_2"><span class="glyphicon glyphicon-step-forward"></span></td>
								</tr>
							</tbody>
						</table></td>
					<td align="right" id="pager_list_2_right"><div class="ui-paging-info" style="text-align: right;" dir="ltr">1 - 20 共 27 条</div></td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
		 */
		

		
		document.getElementById(this.id).innerHTML=s;
	};
	
	this.onPageChanged = function(nextPage_) {

	};

	this.onGoClicked = function(pageNo_, pageSize_) {

	};
	/**
	 * 内部方法.
	 */
	this.fnPageClick = function(index) {
		var nextPage = 0;
		this.currentPage = getCurrentPage(grid);
		this.pageCount = getPageCount(grid);
		if (index == "first") {
			nextPage = 1;
		} else if (index == "prev") {
			nextPage = this.currentPage - 1;
		} else if (index == "next") {
			nextPage = this.currentPage + 1;
		} else if (index == "last") {
			nextPage = this.pageCount;
		} else {
			nextPage = 1;
		}
		this.onPageChanged(nextPage);
	};

	this.setPageSize = function(value_) {
		this.pageSize = value_;
	};

	this.showDivPageDhtmx = function() {
		var self = this;
		if (self.flag == false) {
			document.getElementById("pageSize" + self.id).onblur = function() {
				var obj = this;
				obj.value = obj.value.replace(/ /g, "");
				//if (obj.value.length == 0 || !isNumberInt(obj.value)) {
				if (obj.value.length == 0 ) {
					obj.value = self.pageSize;
					return false;
				} else {
					var tmp = document.getElementById("pageSize" + self.id).value;
					if(self.pageSize != tmp){
						self.pageSize = tmp;
						self.currentPage =1;
						document.getElementById("pageNo" + self.id).value=1;
						self.onGoClicked(self.currentPage, self.pageSize);
					}
					return true;
				}
			};
			document.getElementById("pageNo" + self.id).onblur = function() {
				var obj = this;
				obj.value = obj.value.replace(/ /g, "");
				if (obj.value.length == 0) {
					obj.value = self.currentPage;
					return false;
				} else {
					var tmp = document.getElementById("pageNo" + self.id).value;
					if(self.currentPage != tmp){
						self.currentPage = tmp;
						self.onGoClicked(self.currentPage, self.pageSize);
					}
					return true;
				}
			};
			
			document.getElementById("startLabel" + self.id).onclick = function() {
				if (self.flagFirst) {
					self.fnPageClick("first");
				}
			};
			document.getElementById("previousLabel" + self.id).onclick = function() {
				if (self.flagPrev) {
					self.fnPageClick("prev");
				}
			};
			document.getElementById("nextLabel" + self.id).onclick = function() {
				if (self.flagNext) {
					self.fnPageClick("next");
				}
			};
			document.getElementById("endLabel" + self.id).onclick = function() {
				if (self.flagLast) {
					self.fnPageClick("last");
				}
			};
			self.flag = true;
		}
		self.currentPage = parseInt(grid.getUserData("", "currentPage"));
		if (self.currentPage) {
			self.totalCount = parseInt(grid.getUserData("", "totalCount"));
			self.pageCount = parseInt(grid.getUserData("", "pageCount"));
		} else {
			self.totalCount = 0;
			self.currentPage = 0;
			self.pageCount = 0;
		}
		if (self.currentPage > 1) {
			self.flagFirst = true;
			self.flagPrev = true;
			document.getElementById("startLabel" + self.id).disabled = false;
			document.getElementById("previousLabel" + self.id).disabled = false;
		} else {
			self.flagFirst = false;
			self.flagPrev = false;
			document.getElementById("startLabel" + self.id).disabled = true;
			document.getElementById("previousLabel" + self.id).disabled = true;
		}
		if (self.currentPage < self.pageCount) {
			self.flagNext = true;
			self.flagLast = true;
			document.getElementById("endLabel" + self.id).disabled = false;
			document.getElementById("nextLabel" + self.id).disabled = false;
		} else {
			self.flagNext = false;
			self.flagLast = false;
			document.getElementById("endLabel" + self.id).disabled = true;
			document.getElementById("nextLabel" + self.id).disabled = true;
		}
		document.getElementById("pageSize" + self.id).value = self.pageSize;
		document.getElementById("pageNo" + self.id).value = self.currentPage;
		document.getElementById("totalCount" + self.id).innerHTML = "<b> "+self.totalCount+" </b>";
		document.getElementById("totalPage" + self.id).innerHTML = "<b> "+ self.pageCount + " </b>";
	};
}

function getCurrentPage(theGrid) {
	var currentPage = parseInt(theGrid.getUserData("", "currentPage"));
	return currentPage;
}
function getPageCount(theGrid) {
	var pageCount = parseInt(theGrid.getUserData("", "pageCount"));
	return pageCount;
}
function getPageSize(theGrid) {
	var pageSize = parseInt(theGrid.getUserData("", "pageSize"));
	return pageSize;
}
function getTotalCount(theGrid) {
	var totalCount = parseInt(theGrid.getUserData("", "totalCount"));
	return totalCount;
}